from django.db import models
from django.contrib.auth.models import AbstractUser


# Create your models here.


class StudentProfile(AbstractUser):
    """
    django 用户表扩展表，当做学生信息表
    """
    gender_choice = (
        ("0", "女"),
        ("1", "男"),
    )

    username = models.CharField(verbose_name="姓名", max_length=20, unique=True)
    uid = models.IntegerField(verbose_name="学号", default=1000, unique=True, help_text="请输入您的学号")
    phone = models.CharField(verbose_name="手机", max_length=50, unique=True, null=True, blank=True)
    gender = models.CharField(verbose_name="性别", max_length=50, choices=gender_choice, blank=True, null=True)
    address = models.CharField(verbose_name="地址", max_length=200, null=True, blank=True)

    class Meta:
        verbose_name = "学生信息"
        verbose_name_plural = "学生信息列表"

    def __str__(self):
        return "%s_%s" % (self.uid, self.username)
